<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>task14</title>
    <style type="text/css">
    * {
        font-family: "微软雅黑";
    }
    </style>
</head>

<body>
    <h3>污染城市列表</h3>
    <ul id="aqi-list">
    </ul>
    <script type="text/javascript">
    var aqiData = [
        ["北京", 90],
        ["上海", 50],
        ["福州", 10],
        ["广州", 50],
        ["成都", 90],
        ["西安", 100]
    ];

    (function() {
        /*
        在注释下方编写代码
        遍历读取aqiData中各个城市的数据
        将空气质量指数大于60的城市显示到aqi-list的列表中
        */
        aqiData = aqiData.filter(function(d) {
            return (d[1] > 60);
        }).sort(function(d1, d2) {
            return d1[1] - d2[1];
        });

        var ul = document.getElementById("aqi-list");
        var items = "";
        for (var i = 0; i < aqiData.length; i++) {
            var data = aqiData[i];
            items += '<li>第' + (i + 1) + '名：' + data[0] + ',' + data[1] + '</li>';
        }
        ul.innerHTML = items;
    })();
    </script>
</body>

</html>
